import Vue from 'vue'
import VueRouter from 'vue-router'
import LayoutView from '../LayoutView.vue'
import FenleiView from '../views/FenleiView.vue'


Vue.use(VueRouter)

const routes = [

  {
    path: '/',
    redirect:'index',
    name: 'layout',
   component: LayoutView,
    children:[
      {
        path:'index',
        redirect:'/fenlei',
        name:'home',
        component:() => import('../views/HomeView.vue'),
        children:[
          {
            path:'/fenlei',
            name:'fenlei',
            component:FenleiView
          },
          {
            path:'/bangdan',
            name:'bangdan',
            component:()=>import('../views/bangdanView.vue')
          },
          {
            path:'/shuku',
            name:'shuku',
            component:()=>import('../views/shukuView.vue')
          },
        ]
      },
      {
        path:'list',
        name:'list',
        component:()=>import('../views/ListView.vue')
      },
      {
        path:'my',
        name:'my',
        component:()=>import('../views/MyView.vue')
      }

    ]
  },
  // 详情页
  {
    path:'/novel',
    name:'novel',
    component:()=>import('../views/novelView.vue')
  },
  {
    path:'/detail',
    name:'detail',
    component:()=>import('../views/DetailView.vue')
  },
  {
    path:'/search',
    name:'search',
    component:()=>import('../views/SearchView.vue')
  },
  {
    path:'/login',
    name:'login',
    component: ()=>import('../views/LoginVIew.vue')
  },
  {
    path:'/register',
    name:'register',
    component:()=>import('../views/RegisterVIew.vue')
  },
  {
    path:'*',
    name:'error',
    component:()=>import('../views/ErrorView.vue')
  }
  
]

const router = new VueRouter({
  routes
})

export default router
